package com.snatch.data.service.impl;

import org.springframework.stereotype.Service;

import com.snatch.common.constant.SnatchConstant;
import com.snatch.data.service.CheckService;
import com.snatch.data.vo.Root;
import com.snatch.snatchmgr.util.ToXmlUtil;

@Service
public class CheckServiceImpl implements CheckService {
	public int checkUser(String ident,String uuid){
		/**
		 * 用户api权限认证
		 */
		if("admin8".equals(ident) && "admin8".equals(uuid)){
			return SnatchConstant.SUCCESS;
		}else{
			return SnatchConstant.LOGIN_FAIL_WRONG_USERNAME_OR_PASSWORD;
		}
	}

	@Override
	public String checkFailXml(int failCode) {
		Root root = new Root();
		if(SnatchConstant.LOGIN_FAIL_WRONG_USERNAME_OR_PASSWORD == failCode){
			root.setSuccess(SnatchConstant.LOGIN_FAIL_WRONG_USERNAME_OR_PASSWORD);
			root.setError("请校验您用户名和密码！");
		}
		
		return ToXmlUtil.rootToXml(root);
	}
}